import router from '../router/index'

import axios from './axios';

const domain = 'https://wxapp.gzmmkj.cn/api/admin/';
axios.defaults.baseURL = domain;
axios.interceptors.response.use(function (response) {
  // 重定向到登录页面 
  if (response.data.data == 'no_login') {
    window.localStorage.removeItem('user_name');
    router.replace({path: '/login'})
  } else {
    return response;
  }
})

//获取验证码
export const getCode = (params) => axios.post('https://wxapp.gzmmkj.cn/api/auth/sendVerificationCode', params);

//会员管理
//用户管理-用户列表
export const getUserList = (params) => axios.get('getUserList', {'params': {...params}});
//用户详情
export const getUserDetail = (params) => axios.get('user/getUserDetail', {'params':{...params}});

//新增兑换记录
export const setIntegralExchangeRecord = (params) => axios.post('sys/setIntegralExchangeRecord', params);

//内容管理
//内容管理-品牌列表
export const getBrandList = (params) => axios.get('getBrandList', {'params': {...params}});
// 内容管理-人物列表
export const getCharacterList = (params) => axios.get('getCharacterList', {'params': {...params}});
//内容管理-企业列表
export const getCompanyList = (params) => axios.get('getCompanyList', {'params': {...params}});


//新增/修改公司信息
export const setCompany = (params) => axios.post('sys/setCompany', params);
//获取公司信息
export const getCompany = (params) => axios.get('sys/getCompany', {'params': {...params}});
//删除公司
export const delCompany = (params) => axios.post('sys/delCompany', params);
//获取行业列表（筛选框）
export const getIndustryList = (params) => axios.get('https://wxapp.gzmmkj.cn/api/getIndustryList', {'params': {...params}});
//按关键词查找公司
// export const searchCompany = (params) => axios.get('sys/searchCompany',{'params':{...params}});


//新增/修改品牌
export const setBrand = (params) => axios.post('sys/setBrand', params);
//删除品牌
export const delBrand = (params) => axios.post('sys/delBrand', params);
//获取品牌信息
export const getBrand = (params) => axios.get('sys/getBrand', {'params': {...params}});
//按关键词查找品牌
// export const searchBrand = (params) => axios.get('sys/searchBrand',{'params':{...params}});


//修改/新增人物
export const setCharacter = (params) => axios.post('sys/setCharacter', params);
//获取人物信息
export const getCharacter = (params) => axios.get('sys/getCharacter', {'params': {...params}});
//删除人物
export const delCharacter = (params) => axios.post('sys/delCharacter', params);
//按关键词查找人物
// export const searchCharacter = (params) => axios.get('sys/searchCharacter',{'params':{...params}});

//点击切换热榜
export const updateIsHotStatus = (params) => axios.post('sys/updateIsHotStatus', params);

//获取内容审核列表
export const getContentApply = (params) => axios.get('sys/getContentApply', {'params': {...params}});
// 改变内容审核的状态
export const changeContentApplyStatus = (params) => axios.post('sys/changeContentApplyStatus ', params);
//删除审核
export const delContentApply = (params) => axios.post('sys/delContentApply', params);
//获取审核内容详情
export const getContentApplyDetail = (params) => axios.get('sys/getContentApplyDetail', {'params': {...params}});



//后台登陆
//登陆功能
export const signInUser = (params) => axios.post('signInUser', params);

export const userAdminLogin = (params) => axios.post('userAdminLogin', params);


//广告语
//设置推广文案
export const setAutoText = (params) => axios.post('sys/setAutoText', params);
//获取推广文案
export const getAutoTextDetail = (params) => axios.get('sys/getAutoTextDetail', {'params': {...params}});
//设置推广文案开关
export const setAutoTextStatus = (params) => axios.post('sys/setAutoTextStatus', params);

//获取分销规则
export const getDistributionRule = (params) => axios.get('sys/getDistributionRule', {'params': {...params}});
//设置分销规则
export const setDistributionRule = (params) => axios.post('sys/setDistributionRule', params);

//获取兑换记录列表
export const getIntegralExchangeList = (params) => axios.get('sys/getIntegralExchangeList', {'params': {...params}});

//获取兑换规则
export const getExchangeRule = (params) => axios.get('sys/getExchangeRule', {'params': {...params}});
//设置兑换规则
export const setExchangeRule = (params) => axios.post('sys/setExchangeRule', params);


//宣传管理


//退出登陆&&修改密码    
//获取管理员用户信息
export const getAdminUserInfo = (params) => axios.get('getAdminUserInfo', {'params': {...params}});
//用户退出
export const loginOut = () => axios.post('loginOut');
//修改密码
export const changePassword = (params) => axios.post('changePassword', params);

//系统管理模块
//获取管理员列表
export const getAdminList = (params) => axios.get('adminList', {'params': {...params}});
//编辑管理员
export const adminSet = (params) => axios.get('adminSet', {'params': {...params}});
//添加管理员
export const setAdmin = (params) => axios.post('setAdmin', params);
//删除管理员
export const delAdmin = (params) => axios.post('delAdmin', params);


//轮播图
export const getBannerList = (params) => axios.get('getBannerList', {'params': {...params}});
//新增/修改banner
export const setBanner = (params) => axios.post('sys/setBanner', params);
//删除banner
export const delBanner = (params) => axios.post('sys/delBanner', params);
//获取banner 信息
export const getBanner = (params) => axios.get('sys/getBanner', {'params': {...params}});


//栏目管理
export const getFeaturesMenu = (params) => axios.get('getFeaturesMenu', {'params': {...params}});
//新增栏目
export const setFeaturesMenu = (params) => axios.post('setFeaturesMenu', params);
//删除栏目
export const delFeaturesMenu = (params) => axios.post('delFeaturesMenu', params);

//获取套餐列表
export const getUserVipList = (params) => axios.get('getUserVipList', {'params': {...params}});
//获取付费套餐
export const getVipPackageList = (params) => axios.get('operation/getVipPackageList', {'params': {...params}});
//获取用户权益
export const getVipRuleList = (params) => axios.get('operation/getVipRuleList', {'params': {...params}});
export const getUserRightsList = (params) => axios.get('operation/getUserRightsList', {'params': {...params}});
//删除套餐
export const delVipPackage = (params) => axios.post('operation/delVipPackage', params);
//设置付费套餐
export const setVipPackage = (params) => axios.post('operation/setVipPackage', params);
//改变套餐状态
export const changeVipPackageStatus = (params) => axios.post('operation/changeVipPackageStatus', params);
//获取套餐详情
export const getVipPackageDetail = (params) => axios.get('operation/getVipPackageDetail', {'params': {...params}});
//绑定套餐
export const vipPackageBindUnit = (params) => axios.post('operation/vipPackageBindUnit', params);
// 删除用户绑定的套餐
export const delUserBindVipPackage = (params) => axios.post('operation/delUserBindVipPackage', params);


//设置服务协议
export const setServiceAgreement = (params) => axios.post('sys/setServiceAgreement', params);
//获取服务协议
export const getServiceAgreement = (params) => axios.get('sys/getServiceAgreement', {'params': {...params}});
//设置服务协议状态
export const changeServiceButton = (params) => axios.post('sys/changeServiceButton', params);


//获取用户权益及规则
export const getUserAgreement = (params) => axios.get('sys/getUserAgreement', {'params': {...params}});
//设置用户权益及规则
export const setUserAgreement = (params) => axios.post('sys/setUserAgreement', params);
//设置用户权益及规则状态
export const changeUserAgreementButton = (params) => axios.post('sys/changeUserAgreementButton', params);

//获取支付状态
export const getPayStatus = (params) => axios.get('https://wxapp.gzmmkj.cn/api/payment/getPayStatus', {'params': {...params}});
//获取支付二维码
export const getPayQrCode = (params) => axios.get('https://wxapp.gzmmkj.cn/api/payment/getPayQrCode', {'params': {...params}});
//微信支付
export const weChatPayment = (params) => axios.post('https://wxapp.gzmmkj.cn/api/payment/weChatPayment',params);
//生成订单
export const buildOrder = (params) => axios.post('https://wxapp.gzmmkj.cn/api/order/buildOrder',params);
